/**
 * @License: (C) Copyright 2013-2022
 * @Contact: abcque@outlook.com
 * @IDE: IntelliJ IDEA
 * @Encoding: utf-8
 * @Project: st2212 2213
 * @Package: PACKAGE_NAME
 * @File: ArraySum.java
 * @Time: 2022/12/15 15:38
 * @Author: abcque
 * @Description: 二维数组所有元素求和
 * @Modifier:
 * @ModifyDate:
 * @ModifyRemark:
 */
public class ArraySum {
    public static void main(String[] args) {
        int[][] arr = {{3, 5, 8}, {12, 9}, {7, 0, 6, 4}};

        int sum = 0;
        // 数组的长度一定要使用 .length 属性
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                sum += arr[i][j];
            }
        }

        System.out.println("sum = " + sum);
    }
}
